package org.mii.safeguard_v1.admin.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.mii.safeguard_v1.base.web.CrudActionSupport;
import org.mii.safeguard_v1.security.service.UserManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.web.struts2.Struts2Utils;

import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
@Results( {
		@Result(name = CrudActionSupport.RELOAD, location = "admin.action", type = "redirect"),
		@Result(name = CrudActionSupport.NOTICE, location = "notice.jsp", type = "redirect"),
		@Result(name = CrudActionSupport.DENY_ACCESS, location = "common/403.jsp", type = "redirect") })
public class AdminAction extends ActionSupport {
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	@Autowired
	private UserManager userManager;

	public String index() throws Exception {
		HttpServletRequest request = Struts2Utils.getRequest();
		HttpSession session = Struts2Utils.getSession();
		session.setAttribute("tag", 1);
		session.setAttribute("subTag", 1);
		request.setAttribute("url", "/security/user.action");
		return "";
	}

	public String authManage() throws Exception {
		HttpServletRequest request = Struts2Utils.getRequest();
		HttpSession session = Struts2Utils.getSession();
		session.setAttribute("tag", 1);
		session.setAttribute("subTag", 1);
		request.setAttribute("url", "/security/user.action");

		return "";
	}
}
